#include "../source/vlib.h"
#include <stdio.h>

static int sort_rule_int(void *front, void *back)
{
    if (*(int *)front < *(int *)back)
    {
        return 1;
    }
    else if (*(int *)front > *(int *)back)
    {
        return -1;
    }

    return 0;
}

void ttt(vector_t vector)
{
    for (int i = 0; i < vector_size(vector); i++)
    {
        printf("vector[%d] = %d\r\n", i, vector_at(vector, int, i));
    }
}

void fff(iterator it)
{
    vector_t vector = (vector_t)it.object;
    printf("%p,%d\r\n", it.object, it.object->size);
    printf("size %d\r\n", vector_size(vector));
    for (int i = 0; i < vector_size(vector); i++)
    {
        printf("vector[%d] = %d\r\n", i, vector_at(vector, int, i));
    }
}

int pred(void *data)
{
    // return ((*(int *)data) >= 3) ? 1 : 0;
    return ((*(int *)data) %2 == 0) ? 1 : 0;
}

void test_vector(void)
{
    vector_t vector = vector(int, 7);
    for (int i = 0; i < vector_size(vector); i++)
    {
        vector_at(vector, int, i) = i;
    }
    vector_erase(vector, 2, 4);
    for (int i = 0; i < vector_size(vector); i++)
    {
        printf("vector[%d] = %d\r\n", i, vector_at(vector, int, i));
    }
    _vector(vector);
}